<?php 
	/**
	 * 提现已发放记录
	 */
    session_start();
    require_once("../includes/public.inc.php");
    require_once ("../mobile/shop.php");
    $openid = isset($_SESSION['openid'])?$_SESSION['openid']:'';
    $openusers =  mysql_fetch_array(mysql_query("select * from ".DBQIAN."users where openid='".$openid."' order by id desc limit 1"));
	//print_r($openusers);exit;
    if ($openusers) 
    {
        $buy = mysql_query("select * from ".DBQIAN."buylog where paystatus=1 and openid='".$openid."' order by create_time");  
		$buy_log = array();
		$totalmoney = 0.00;
        while ($row = mysql_fetch_array($buy))
		{
			$buy_log[] = $row;
			if ($row['paystatus'] == 1)
			{
				$totalmoney += $row['price'];
			}
		}
		$buy_wait = mysql_fetch_array(mysql_query("select count(*) as quantity from ".DBQIAN."buylog where status=2 and openid='".$openid."' order by create_time limit 1"));  
    }
    else
    {
       echo "<script>alert('非法进入!');history.back();</script>";
       exit;
    }
?>
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport"content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title></title>
<link rel="stylesheet" href="css/resetbase.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/jd_cart.css">
<link type="text/css" href="css/css.css" rel="stylesheet" />
</head>
<body>
<!--顶部通栏-->
    <header class="jd_topBar" style="background:#2299dd;border:1px #2299dd solid;">
        <a href="javascript:history.go(-1)" class="icon_back"></a>
        <h3 style="color:#fff;">已付款</h3>
        <a href="person.php"class="icon_home"></a>
    </header>


<!--安全提示-->
<div class="safety-tip">
   <p class="fadeInDown animated">您正在安全购物环境中，请放心购物</p>
</div>
<div id="xq" class="pz-panel">
	<ul class="navs">
    <li><img src="<?=$openusers['headimg_url']?>" alt="头像"><p><?=$openusers['name']?></p></li>
    <li class="center"><img src="./image/ymai.png"><p>已购买：<?=$totalmoney?></p></li>
    <li><img src="./image/wff.png"><p>待发货：<?=$buy_wait['quantity'] ?></p></li>
	</ul>
</div>
<!--店铺-->
 <div class="jd_shop">
     <!--<div class="jd_shop_tit">
        <div class="check_box">
            <a href="#" class="jd_check_box"></a>
        </div>
        <div class="shop_info">
            <div class="jd_logo f_left">
                <img src="images/buy-logo.png" alt="">
                <span>京东自营</span>
            </div>
            <div class="f_right tip m_r10">
                您享受满79元免运费服务
            </div>

        </div>
    </div>-->
    <?foreach ($buy_log as $bl):?>
    <?
		$pro = getProductDetail($bl['product_id']);    
    ?>
     <div class="jd_shop_con">
         <div class="product">
             <div class="check_box">
                 <a href="#" class="jd_check_box" checked></a>
             </div>
             <div class="shop_info clearfix">
                 <a href="orderdetail.php?id=<?=$bl['id']?>" class="img_box f_left"><img src="<?=$pro['img']?>" alt=""></a>
                 <div class="info_box">
                     <a class="p_name" href="productdetail.php?id=<?=$bl['product_id']?>"><?=$bl['product_name']?> </a>
                     <p class="p_price">&yen;<?=$bl['price']?></p>
                     <div class="p_opition">
                     	状态：已付款<br>
                     	订单号：<?=$bl['ordernumber']?>
                        <!--<div class="change_num f_left">
                            <span>-</span>
                            <input type="tel">
                            <span>+</span>
                        </div>-->
                        <div class="delete_box f_right">
                            <span class="delete_up"></span>
                            <span class="delete_down"></span>
                        </div>
                     </div>
                 </div>
             </div>
         </div>
     </div>
     <?endforeach;?>
 </div>
<div class="jd_win">
    <div class="jd_win_box">
        <div class="jd_win_tit">禁止删除该记录</div>
        <div class="jd_btn clearfix">
            <a href="#" class="cancle f_left">取消</a>
            <a href="#" class="submit f_right">确定</a>
        </div>

    </div>
</div>
<script src='js/jquery-1.9.0.min.js'></script>
<script src="js/cartjs.js"></script>
</body>
</html>